﻿<UserControl x:Class="ViCode_LeVi.Controls.VMTabBudget"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:vmcontrol="clr-namespace:ViCode_LeVi.Controls"
        xmlns:Langs="clr-namespace:ViCode_LeVi.Langs"
        xmlns:Data="clr-namespace:ViCode_LeVi.Data">
    <UserControl.Resources>
        <HierarchicalDataTemplate DataType="{x:Type Data:Step_Budget}" 
                              ItemsSource="{Binding Path=ObservableCollection_Childs}">
            <StackPanel Orientation="Horizontal">
                <!--<vmcontrol:VMTextBlockExt_ControlTextInfoInData TextPath="Step_Budget_Name_Text"/>-->
                <TextBlock Text="{Binding Path=Name, Mode=TwoWay}" 
                 ToolTip="{Binding Path=CostCurrent}" Margin="1"/>
                <!--<vmcontrol:VMTextBlockExt_ControlTextInfoInData TextPath="Step_Budget_Total_Cost_Text"/>-->
                <TextBlock Text="("  Margin="1"/>
                <TextBlock Text="{Binding Path=CostCurrent, Mode=OneWay}" 
                 ToolTip="{Binding Path=CostCurrent}"  Margin="1"/>
                <TextBlock Text=")"  Margin="1"/>
            </StackPanel>

        </HierarchicalDataTemplate>
        <Style TargetType="TreeViewItem">
            <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}"/>
            <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}"/>
        </Style>
    </UserControl.Resources>
    <vmcontrol:VMRootControl>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition  Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <TreeView IsTabStop="True" x:Name="TreeView_root"  >

                </TreeView>
                <GroupBox Grid.Row="1" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>

                        </Grid.ColumnDefinitions>
                        <vmcontrol:VMTextBlockExt_ControlTextInfoInData VerticalAlignment="Center" Margin="2" TextPath="Step_Budget_Name_Text" HorizontalAlignment="Right" />
                        <vmcontrol:VMTextBox VerticalAlignment="Center" Margin="2" Text="{Binding ElementName=TreeView_root, Path=SelectedItem.Name}" Grid.Column="1" IsEnabled="{Binding IsEnableChangeInfo, Mode = OneWay}" HorizontalAlignment="Stretch"/>
                        <vmcontrol:VMTextBlockExt_ControlTextInfoInData VerticalAlignment="Center" Margin="2" TextPath="Step_Budget_Cost_Text" HorizontalAlignment="Right" Grid.Row="1" />
                        <vmcontrol:VMTextBox_Number x:Name="VMTextBox_Number_Cost" VerticalAlignment="Center" Margin="2" 
                                                    Text="{Binding ElementName=TreeView_root, Path=SelectedItem.Cost, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="1" 
                                                    IsEnabled="{Binding ElementName=TreeView_root, Path=SelectedItem.CanEditCost, Mode = OneWay}" HorizontalAlignment="Stretch"/>
                        <vmcontrol:VMTextBlockExt_ControlTextInfoInData VerticalAlignment="Center" Margin="2" TextPath="Step_Budget_Note_Text" HorizontalAlignment="Right" Grid.Row="2" />
                        <vmcontrol:VMTextBox_MultiLine VerticalAlignment="Center" Margin="2" Text="{Binding ElementName=TreeView_root, Path=SelectedItem.Note}" Grid.Column="2" Grid.Row="2"/>
                    </Grid>
                </GroupBox>
                <StackPanel  Grid.Row="2" HorizontalAlignment="Right" Orientation="Horizontal">
                    <Button Name="Button_AddNew" Content="Add" Margin="2"/>
                    <Button Name="Button_Remove" Content="Delete" Margin="2"/>
                    <Button Name="Button_RefreshChart" Content="Refresh Chart" Margin="2"/>
                    <Button Name="Button_ShowChartWindows" Content="Show Full Chart" Margin="2"/>
                </StackPanel>


            </Grid>

            <GridSplitter HorizontalAlignment="Right" Width="2" Background="WhiteSmoke" VerticalAlignment="Stretch"/>

            <GroupBox Header="Chart" Grid.Column="1" >
                <vmcontrol:VMTabBudgetChart x:Name="VMTabBudgetChart_Item"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
            </GroupBox>
        </Grid>

    </vmcontrol:VMRootControl>
</UserControl>
